package cn.yy.pojo;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Inmatirial entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "inmatirial", catalog = "phoneerp")
public class Inmatirial implements java.io.Serializable {

	// Fields

	private Integer matirialId;
	private Emp emp;
	private Matirialtype matirialtype;
	private Confirm confirm;
	private Provider provider;
	private Matirialunit matirialunit;
	private String matirialName;
	private Date inDate;
	private Double unitPrice;
	private Double amount;
	private Double totalPrice;
	private Integer accountId;
	private Set<Reposity> reposities = new HashSet<Reposity>(0);
	private Set<Paybill> paybills = new HashSet<Paybill>(0);

	// Constructors

	/** default constructor */
	public Inmatirial() {
	}

	/** minimal constructor */
	public Inmatirial(Emp emp, Matirialtype matirialtype, Confirm confirm,
			Provider provider, Matirialunit matirialunit, String matirialName,
			Date inDate, Double unitPrice, Double amount, Double totalPrice,
			Integer accountId) {
		this.emp = emp;
		this.matirialtype = matirialtype;
		this.confirm = confirm;
		this.provider = provider;
		this.matirialunit = matirialunit;
		this.matirialName = matirialName;
		this.inDate = inDate;
		this.unitPrice = unitPrice;
		this.amount = amount;
		this.totalPrice = totalPrice;
		this.accountId = accountId;
	}

	/** full constructor */
	public Inmatirial(Emp emp, Matirialtype matirialtype, Confirm confirm,
			Provider provider, Matirialunit matirialunit, String matirialName,
			Date inDate, Double unitPrice, Double amount, Double totalPrice,
			Integer accountId, Set<Reposity> reposities, Set<Paybill> paybills) {
		this.emp = emp;
		this.matirialtype = matirialtype;
		this.confirm = confirm;
		this.provider = provider;
		this.matirialunit = matirialunit;
		this.matirialName = matirialName;
		this.inDate = inDate;
		this.unitPrice = unitPrice;
		this.amount = amount;
		this.totalPrice = totalPrice;
		this.accountId = accountId;
		this.reposities = reposities;
		this.paybills = paybills;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "matirialId", unique = true, nullable = false)
	public Integer getMatirialId() {
		return this.matirialId;
	}

	public void setMatirialId(Integer matirialId) {
		this.matirialId = matirialId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "empID", nullable = false)
	public Emp getEmp() {
		return this.emp;
	}

	public void setEmp(Emp emp) {
		this.emp = emp;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TypeId", nullable = false)
	public Matirialtype getMatirialtype() {
		return this.matirialtype;
	}

	public void setMatirialtype(Matirialtype matirialtype) {
		this.matirialtype = matirialtype;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "confirmId", nullable = false)
	public Confirm getConfirm() {
		return this.confirm;
	}

	public void setConfirm(Confirm confirm) {
		this.confirm = confirm;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "providerID", nullable = false)
	public Provider getProvider() {
		return this.provider;
	}

	public void setProvider(Provider provider) {
		this.provider = provider;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "unitID", nullable = false)
	public Matirialunit getMatirialunit() {
		return this.matirialunit;
	}

	public void setMatirialunit(Matirialunit matirialunit) {
		this.matirialunit = matirialunit;
	}

	@Column(name = "matirialName", nullable = false, length = 10)
	public String getMatirialName() {
		return this.matirialName;
	}

	public void setMatirialName(String matirialName) {
		this.matirialName = matirialName;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "inDate", nullable = false, length = 10)
	public Date getInDate() {
		return this.inDate;
	}

	public void setInDate(Date inDate) {
		this.inDate = inDate;
	}

	@Column(name = "unitPrice", nullable = false, precision = 22, scale = 0)
	public Double getUnitPrice() {
		return this.unitPrice;
	}

	public void setUnitPrice(Double unitPrice) {
		this.unitPrice = unitPrice;
	}

	@Column(name = "amount", nullable = false, precision = 22, scale = 0)
	public Double getAmount() {
		return this.amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	@Column(name = "totalPrice", nullable = false, precision = 22, scale = 0)
	public Double getTotalPrice() {
		return this.totalPrice;
	}

	public void setTotalPrice(Double totalPrice) {
		this.totalPrice = totalPrice;
	}

	@Column(name = "accountId", nullable = false)
	public Integer getAccountId() {
		return this.accountId;
	}

	public void setAccountId(Integer accountId) {
		this.accountId = accountId;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "inmatirial")
	public Set<Reposity> getReposities() {
		return this.reposities;
	}

	public void setReposities(Set<Reposity> reposities) {
		this.reposities = reposities;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "inmatirial")
	public Set<Paybill> getPaybills() {
		return this.paybills;
	}

	public void setPaybills(Set<Paybill> paybills) {
		this.paybills = paybills;
	}

}